/*
** TO COMPILE: gcc -Wall main.c -o gti -lm `pkg-config --cflags --libs glib-2.0`
** TO EXECUTE: ./gti [filename]
*/

#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <glib.h>
#include <inttypes.h>
#include <linux/types.h>
#include <math.h>
#include <netinet/in.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/termios.h>
#include <sys/time.h>
#include <unistd.h>

typedef struct _Controller Controller;
typedef struct _Client Client;
typedef struct _NetworkReceiveArg NetworkReceiveArg;
typedef struct _Network Network;
typedef struct _Telescope Telescope;

#include "cexcept.h"

define_exception_type(int);
extern struct exception_context the_exception_context[1];
struct exception_context the_exception_context[1];
pthread_mutex_t mutex;

#include "Controller.h"

int main(int argc, char **argv) {
	char path[256] = "gti.conf";
	if(argc == 2)
		strcpy(path, argv[1]);
	Controller *ct = controller_new(path);
	controller_start(ct);
	controller_execute(ct);
	return EXIT_SUCCESS;
}
